//
//  HZApiTool.h
//  HZTC_YaDeArt
//
//  Created by MayerF on 17/3/24.
//  Copyright © 2017年 HZTC. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HZApiTool : NSObject
/**
 *  GET 请求
 */
+ (NSURLSessionDataTask *)getUrl:(NSString *)url
                          params:(NSDictionary *)params
                         success:(void (^)(id))success
                         failure:(void (^)(NSError *error))failure;
/**
 *  GET 请求
 *  responseNoJson :返回的数据是否不是标准json结构
 */
+ (NSURLSessionDataTask *)getUrl:(NSString *)url
                          params:(NSDictionary *)params
                  responseNoJson:(BOOL)responseNoJson
                         success:(void (^)(id))success
                         failure:(void (^)(NSError *error))failure;

/**
 *  POST请求
 */
+ (NSURLSessionDataTask *)postUrl:(NSString *)url
                           params:(NSDictionary *)params
                          success:(void (^)(id x))success
                          failure:(void (^)(NSError *error))failure;
/**
 *  发送POST请求
 *  responseNoJson :返回的数据是否不是标准json结构
 */
+ (NSURLSessionDataTask *)postUrl:(NSString *)url
                           params:(NSDictionary *)params
                   responseNoJson:(BOOL)responseNoJson
                          success:(void (^)(id x))success
                          failure:(void (^)(NSError *error))failure;
/**
 *  发送POST请求
 *  progress :数据进度
 */
+ (NSURLSessionDataTask *)postUrl:(NSString *)url
                           params:(NSDictionary *)params
                         progress:(void (^)(id))progress
                          success:(void (^)(id x))success
                          failure:(void (^)(NSError *error))failure;
/**
 *  发送POST请求
 *  responseNoJson :返回的数据不是标准json结构
 *  progress :数据进度
 */
+ (NSURLSessionDataTask *)postUrl:(NSString *)url
                           params:(NSDictionary *)params
                   responseNoJson:(BOOL)responseNoJson
                         progress:(void (^)(id))progress
                          success:(void (^)(id x))success
                          failure:(void (^)(NSError *error))failure;
/**
 *  发送请求数据格式是json结构的POST请求
 */
+ (NSURLSessionDataTask *)postJsonUrl:(NSString *)url
                               params:(NSDictionary *)params
                              success:(void (^)(id x))success
                              failure:(void (^)(NSError *error))failure;
/**
 *  发送请求数据格式是json结构的POST请求
 *  progress :数据进度
 */
+ (NSURLSessionDataTask *)postJsonUrl:(NSString *)url
                               params:(NSDictionary *)params
                             progress:(void (^)(id))progress
                              success:(void (^)(id x))success
                              failure:(void (^)(NSError *error))failure;
/**
 *  发送POST请求
 *  requestIsJson :请求数据格式是json结构
 *  responseNoJson :返回的数据不是标准json结构
 *  progress :数据进度
 */
+ (NSURLSessionDataTask *)postUrl:(NSString *)url
                           params:(NSDictionary *)params
                    requestIsJson:(BOOL)requestIsJson
                   responseNoJson:(BOOL)responseNoJson
                         progress:(void (^)(id))progress
                          success:(void (^)(id x))success
                          failure:(void (^)(NSError *error))failure;

/**
 *  无缓存 GET 请求
 */
+ (NSURLSessionDataTask *)getNoCacheUrl:(NSString *)url
                                 params:(NSDictionary *)params
                                success:(void (^)(id))success
                                failure:(void (^)(NSError *error))failure;

@end
